package com.iqiyi.pps.epg.core.service.carousel;

import com.iqiyi.pps.epg.api.model.web.carousel.TAutomationPage;
import com.iqiyi.pps.epg.api.model.web.carousel.TCarouselAutomation;
import com.iqiyi.pps.epg.api.model.web.carousel.TCarouselEpisodePage;
import com.iqiyi.pps.epg.api.model.web.carousel.TCarouselPage;
import com.iqiyi.pps.epg.api.model.web.query.TFilter;
import com.iqiyi.pps.epg.api.model.web.query.TPage;
import com.iqiyi.pps.epg.core.model.carousel.AutoCarouselEpisodeLibrary;
import com.iqiyi.pps.epg.core.model.carousel.AutoCarouselEpisodeRule;
import com.iqiyi.pps.epg.core.model.carousel.CarouselBase;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;

import java.util.List;

/**
 * Created by Lemuel on 2015/6/5.
 */
public interface CarouselService {
    CarouselBase getCarouselBase(long id);

    void saveBase(CarouselBase entity);

    boolean delCarousel(String ids);

    TCarouselPage getCarouselList(TPage page, TFilter filter);

    TCarouselPage getList(TPage page, TFilter filter);

    TAutomationPage getAutomationList(TPage page, TFilter filter);

    void executeRules(CarouselBase entity, String createDays, String createStartTime);

    List<CarouselBase> getCarouselToUpdate();

    List<CarouselBase> getCarouselToFollow();

    void updateFollowQipuId(CarouselBase carouselBase);

    Boolean checkRuleExpire(CarouselBase carouselBase, Integer daysLeft);

    int getCarouselCreateDay();

    int delByChannelId(long channelId);

    int delAutomationByChannelId(long channelId);

    List<AutoCarouselEpisodeRule> getCarouselAutomationList(long channelId);

    AutoCarouselEpisodeRule getByAutomationId(long entityId);

    AutoCarouselEpisodeLibrary getByEpisodeLibraryId(long entityId);

    void saveAutomation(AutoCarouselEpisodeRule entity);

    void updateAutomationList(List<AutoCarouselEpisodeRule> saveList);

    void saveCarouselEpisode(AutoCarouselEpisodeLibrary entity);

    boolean delAutomation(String ids);

    int indexMoveAutomation(long selId, long aimId);

    int indexMoveEpisode(long selId, long aimId);

    int indexMoveAutomationByIndex(long selId,  int aimIndex);

    int indexMoveEpisodeByIndex(long selId ,  int aimIndex);

    int changeAutomationStatus(long channelId, int execStatusNew, int execStatusOld);

    List<TCarouselAutomation> transToTCarouselAutomationList(List<AutoCarouselEpisodeRule> list);

    TCarouselAutomation transToTCarouselAutomation(AutoCarouselEpisodeRule tempData);

    List<AutoCarouselEpisodeRule> queryAutomationByCriterion(List<Criterion> list, List<Order> orderList, int maxResultNum);

    List<AutoCarouselEpisodeRule> getAutomationToUpdate();

    int resetAutomation(long channelId);

    List<AutoCarouselEpisodeLibrary> getCarouselAutomationProgramList(long channelId);

    TCarouselEpisodePage getCarouselEpisodeList(TPage page, TFilter filter);

    boolean saveAutoProgramDataList(List<AutoCarouselEpisodeLibrary> saveList, long channelId);

    List<Long> queryHasQipuIds(long channelId, List<Long> qipuIds);

    boolean delCarouselEpisode(String ids);

    boolean isLibraryRuleRunning(long channelId);

    boolean  hasEpisodeLibraryByChannelId(long channelId);

}
